home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mintmant / psetlimi.txt < prev    next >
Text File  |  1992-03-24  |  3KB  |  130 lines

  1. Psetlimit(2)              Oct. 1, 1991               Psetlimit(2)
  2.  
  3.  
  4.  
  5. NAME
  6.      Psetlimit - get or set limits on use of system resources
  7.  
  8. SYNOPSIS
  9.      LONG Psetlimit( WORD lim, LONG value );
  10.  
  11. DESCRIPTION
  12.      Psetlimit gets or sets a resource limit for a process. Which
  13.      limit  is  affected is governed by the value of lim, as fol-
  14.      lows:
  15.          1: get/set maximum CPU time for process (in milliseconds)
  16.          2: get/set total maximum memory allowed for process
  17.          3: get/set limit on Malloc'd memory for process
  18.  
  19.      If value is negative, the limit is unchanged; if value is 0,
  20.      the  corresponding  resource  is  unlimited;  otherwise, the
  21.      resource limit is set to value.
  22.  
  23.  
  24.      Setting the "maximum memory" limit means the process is  not
  25.      allowed  to  grow bigger than that size overall. Setting the
  26.      "maximum Malloc'ed" limit means that the process  may  allo-
  27.      cate  no  more than that much memory. The difference is that
  28.      the latter limit applies above and beyond the  text+data+bss
  29.      size of the process.
  30.  
  31.  
  32.      Using Psetlimit sets the corresponding limit  for  both  the
  33.      process  and  any  children it creates thereafter. Note that
  34.      the limits apply to each process individually;  setting  the
  35.      child  CPU  limit  value  to  1000 and then using fork(2) to
  36.      create three children results in each of those children get-
  37.      ting  a  CPU  limit  value of one second. They do not have a
  38.      collective or sum total limit of one second.
  39.  
  40.  
  41.      There is no restriction on increasing a limit.  Any  process
  42.      may  set  any  of  its  limits or its childrens' limits to a
  43.      value greater than  its  current  limit,  or  even  to  zero
  44.      (unlimited).
  45.  
  46.  
  47.      Memory limits do not apply during execution of  Pexec;  that
  48.      is, if a process is limited to (say) 256KB of memory, it can
  49.      still exec a child which uses more
  50.  
  51.  
  52.      Memory limits are not retroactive: if a process  owns  256KB
  53.      of  memory  and  then  calls Psetlimit to restrict itself to
  54.      128KB, it will not be terminated, but no Malloc  calls  will
  55.      succeed until its size drops below 128KB.
  56.  
  57.  
  58.  
  59.  
  60. Version 0.9   Last change: MiNT Programmer's Manual             1
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. Psetlimit(2)              Oct. 1, 1991               Psetlimit(2)
  68.  
  69.  
  70.  
  71.      CPU limits are retroactive, however: if a process  has  used
  72.      three  CPU seconds and calls Psetlimit to restrict itself to
  73.      one second, it will immediately  receive  SIGXCPU  and  ter-
  74.      minate.
  75.  
  76.  
  77. RETURNS
  78.      The old limit (0 if there was no limit).
  79.  
  80.  
  81. BUGS
  82.      Since the limit applies to the process and its children, you
  83.      can't  limit  a  child to, say, one millisecond of CPU time:
  84.      the parent must necessarily limit itself before creating the
  85.      child, and if it has used more than a millisecond itself, it
  86.      will die with SIGXCPU.  A new set of lim arguments is needed
  87.      that  apply to the caller's future children without applying
  88.      to the caller.
  89.  
  90.  
  91.      To alleviate this, the parent must create  a  child  process
  92.      via  Pvfork, and this process (which hasn't consumed any CPU
  93.      time yet) must call Psetlimit and then Pexec to  create  the
  94.      child that is meant to be limited.
  95.  
  96.  
  97. SEE ALSO
  98.      Prusage(2)
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126. Version 0.9   Last change: MiNT Programmer's Manual             2
  127.  
  128.  
  129.  
  130.